package easy;

public class Solution_283 {

    public static void moveZeroes(int[] nums) {
        int i = 0, step = 0, length = nums.length;
        while (i < length) {
            if (nums[i] == 0) {
                step++;
            } else if (step != 0) {
                nums[i - step] = nums[i];
            }
            i++;
        }
        for (int j = 1; j <= step; j++) {
            nums[length - j] = 0;
        }
    }

    public static void main(String[] args) {
        int[] ints = {0, 1, 0, 3, 12};
        moveZeroes(ints);
        for (int anInt : ints) {
            System.out.print(anInt + ",");
        }
    }
}
